package com.xinqing.test.modle;

/**
 * Created by Admin on 2019/11/22.
 */
public class CommonRsp {

    private String msg;
    private Object rslt;
    private ExecuteStatus code;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getRslt() {
        return rslt;
    }

    public void setRslt(Object rslt) {
        this.rslt = rslt;
    }

    public ExecuteStatus getCode() {
        return code;
    }

    public void setCode(ExecuteStatus code) {
        this.code = code;
    }

    public static CommonRsp create(String msg, ExecuteStatus code, Object rslt) {
        CommonRsp commonRsp = new CommonRsp();
        commonRsp.setCode(code);
        commonRsp.setMsg(msg);
        commonRsp.setRslt(rslt);
        return commonRsp;
    }

    @Override
    public String toString() {
        return "CommonRsp{" +
                "msg='" + msg + '\'' +
                ", rslt=" + rslt +
                ", code=" + code +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof CommonRsp)) return false;

        CommonRsp commonRsp = (CommonRsp) o;

        if (getMsg() != null ? !getMsg().equals(commonRsp.getMsg()) : commonRsp.getMsg() != null) return false;
        if (getRslt() != null ? !getRslt().equals(commonRsp.getRslt()) : commonRsp.getRslt() != null) return false;
        return getCode() == commonRsp.getCode();
    }

    @Override
    public int hashCode() {
        int result = getMsg() != null ? getMsg().hashCode() : 0;
        result = 31 * result + (getRslt() != null ? getRslt().hashCode() : 0);
        result = 31 * result + (getCode() != null ? getCode().hashCode() : 0);
        return result;
    }
}
